package com.A21.GuoSai.demo.workflow_adjust.mapper;

import com.A21.GuoSai.demo.service_entity.entity.atom.AtomServicePojo;
import com.A21.GuoSai.demo.service_entity.entity.atom.StaticVarPojo;
import com.A21.GuoSai.demo.service_entity.entity.workflow.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.junit.validator.PublicClassValidator;

import java.util.Date;
import java.util.List;

@Mapper
public interface WorkFlowMapper {

    public List<WorkFlowPojo> getAllServiceFlowList();
    //查询工作流的相关信息
    public WorkFlowPojo getWorkerFlowByFlowId(@Param("flowId") String flowId);
    //查询工作流的Bpmn文件信息
    public String getWorkerFlowBpmnByFlowId(@Param("flowId") String flowId);
    //查询工作流所有的静态变量值
    public List<AtomServicePojo> getWorkerFlowStaVarValueByFlowId(@Param("flowId") String flowId);
    //查询工作流所有的动态变量值
    public List<DynamicVarValuePojo> getWorkerFlowDynVarValueByFlowId(@Param("flowId") String flowId);
    //根据工作流的flowId和ZeebeWorker的名字查询该worker的expressionFlow信息
    public List<String> getWorkerExpressionFlowMessage(@Param("flowId")String flowId,@Param("workerName")String workerName);

    //新建一条工作流，工作流
    public void insertWorkFlow(WorkFlowPojo workFlowPojo);
    public void insertEndEvent(EndEventPojo endEventPojo);
    //像数据库中插入条件结点的信息，包含条件结点的名称、判断条件是什么、flowId等等
    public void insertExpressionFlow(ExpressionFlowPojo expressionFlowPojo);
    //向工作流插入静态变量
    public void insertStaticVarValue(@Param("staVarValue")StaticVarValuePojo staticVarValuePojo);
    //向工作流插入动态变量
    public void insertDynamicVarValue(@Param("dynVarValue")DynamicVarValuePojo dynamicVarValuePojo);


    //更改工作流的bpmn、changeDate、flowName还有flowDesc
    public void updateWorkFlow(@Param("newFlow") WorkFlowPojo workFlowPojo);
    //更改工作流的描述FlowDesc
    public void updateWorkFlowDesc(@Param("flowId")String flowId,@Param("flowDesc") String flowDesc);
    //更改工作流的名称FlowName
    public void updateWorkFlowName(@Param("flowId")String flowId,@Param("flowName") String flowName);
    //更改工作流的Bpmn文件FlowBpmn
    public void updateWorkFlowBpmn(@Param("flowId")String flowId,@Param("bpmn") String flowBpmn);
    //更改工作流的changeDate
    public void updateWorFlowChangeDate(@Param("flowId")String flowId, @Param("newDate")Date date);


    //删除数据库中工作流自身的信息、全部条件结点信息、全部变量信息
    public void deleteWorkFlow(@Param("flowId")String flowId);
    //仅删除数据库中工作流的全部条件结点信息
    public void deleteExpressionFlowByFlowId(@Param("flowId")String flowId);
    //仅删除数据库中与工作流相关的变量信息，会将staVarValue和dynamicValue都删除
    public void deleteWorkFlowVars(@Param("flowId") String flowId);
}
